{extend name="public/base" /}

{block name="title"}<title>{if condition="$data"}{$Think.lang.edit}{else /}{$Think.lang.create}{/if}</title>{/block}

{block name="pjax_container"}
<section class="content-header">
    <h1>场馆管理</h1>
    <ol class="breadcrumb">
        <li class="active"><i class="fa fa-dashboard"></i> 场馆管理</li>
    </ol>
</section>

<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="nav-tabs-custom">
                <ul class="nav nav-tabs">
                    <li class="active"><a href="#tab1" data-toggle="tab">{$Think.lang.base_param}</a></li>
                    <li><a href="#tab2" data-toggle="tab">场馆图片</a></li>
                    <li class="pull-right"><a href="javascript:history.back(-1)" class="btn btn-sm" style="padding:10px 2px;"><i class="fa fa-list"></i> {$Think.lang.back}</a></li>
                </ul>
                <div class="tab-content">
                    <div class="tab-pane active" id="tab1">
                        <form class="form-horizontal" method="POST" action="" onsubmit="return false" >
                            <input type="hidden" name="id" value="{$data.id}" />
                            <input type="hidden" name="actions" value="muser" />
                            <div class="form-group">
                                <label class="col-sm-2 control-label">场馆名称</label>
                                <div class="col-sm-7"><input class="form-control" name="designation" value="{$data.designation}"
                                                             placeholder="场馆名称">

                                                             </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">场馆地址</label>
                                    <div class="col-sm-2" id="city">
                                        <select class="prov"></select>
                                        <select class="city" name='area' disabled="disabled"></select>
                                        <select class="dist" disabled="disabled"></select>
                                    </div>
                                <div class="col-sm-5">
                                    <input class="form-control" name="address" value="{$data.address}"
                                           placeholder="场馆地址"></div>
                            </div>


                        <div class="form-group">
                            <label class="col-sm-2 control-label">场馆介绍</label>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">场馆面积</label>
                            <div class="col-sm-7">

                                <input class="form-control" name="area_size" value=""
                                       placeholder="场馆面积">

                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">场馆器械</label>
                            <div class="col-sm-7">

                                <input class="form-control" name="machine" value=""
                                       placeholder="场馆器械">

                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">可选课程</label>
                            <div class="col-sm-7">

                                <input class="form-control" name="lession" value=""
                                       placeholder="可选课程">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">营业时间</label>
                            <div class="col-sm-7"><input class="form-control" name="business_hours" value="{$data.business_hours}"
                                                         placeholder="营业时间"></div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">Cost</label>
                            <div class="col-sm-7"><input class="form-control" name="cost" value="{$data.cost}"
                                                         placeholder="Cost"></div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">是否有WIFI</label>
                            <div class="col-sm-7">
                                <select class="form-control select2" name="wifi" style="width:100%;">
                                    <option value="1">有</option>
                                    <option value="0">无</option>
                                </select>
                            </div>
                        </div>

                            <div class="form-group">
                                <div class="col-sm-2"></div>
                                <div class="col-sm-7">
                                    <div class="btn-group pull-right">
                                        <button type="submit" class="btn btn-info pull-right sub" data-loading-text="&lt;i class='fa fa-spinner fa-spin '&gt;&lt;/i&gt; {$Think.lang.submit}">{$Think.lang.submit}</button>
                                    </div>
                                    <div class="btn-group pull-left">
                                        <button type="reset" class="btn btn-warning">{$Think.lang.reset}</button>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>

                    <div class="tab-pane" id="tab2">
                        <form class="form-horizontal" method="POST" onsubmit="return false" >
                        <input type="hidden" name="id" value="{$data.id}" />
                        <input type="hidden" name="actions" value="images" />
                           <!-- 多图片上传 -->
                        <div class="form-group">
                            <label class="col-sm-2 control-label">场馆图片</label>
                            <div class="col-sm-7">
                                <div class="img-box full">
                                    <section class=" img-section">
                                        <p class="up-p">场馆图片:&nbsp;<span class="up-span" style='color:red'>*****最多可以上传5张图片,上传大小不超过2M*****</span></p>
                                        <div class="z_photo upimg-div clear" >
                                            <section class="z_file fl">
                                                <img src="/assets/img/a11.png" class="add-img">
                                                <input type="file" name="pic" id="filepic" class="filepic">
                                            </section>
                                        </div>
                                    </section>
                                </div>
                                <aside class="mask works-mask">
                                    <div class="mask-content">
                                        <p class="del-p">确定要删除图片吗？</p>
                                        <p class="check-p"><span class="del-com wsdel-ok">确定</span><span class="wsdel-no">取消</span></p>
                                    </div>
                                </aside>
                            </div>
                        </div>
                    <div class="form-group">
                        <div class="col-sm-2"></div>
                        <div class="col-sm-7">
                            <div class="btn-group pull-right">
                                <button type="submit" class="btn btn-info pull-right sub" data-loading-text="&lt;i class='fa fa-spinner fa-spin '&gt;&lt;/i&gt; {$Think.lang.submit}">{$Think.lang.submit}</button>
                            </div>
                            <div class="btn-group pull-left">
                                <button type="reset" class="btn btn-warning">{$Think.lang.reset}</button>
                            </div>
                        </div>
                    </div>
                    </form>
                </div>


            </div>
        </div>
    </div>
    </div>
</section>
<script type="text/javascript">
   $(function(){
         $("#fileUploadContent").initUpload({
        "uploadUrl":"{:url('Place/upload')}",//上传文件信息地址
        // "size":2048,//文件大小限制，单位kb,默认不限制
        "maxFileNumber":5,//文件个数限制，为整数
        // "filelSavePath":"uploads/image/",//文件上传地址，后台设置的根目录
        "beforeUpload":beforeUploadFun,//在上传前执行的函数
        // "onUpload":onUploadFun，//在上传后执行的函数
        //autoCommit:true,//文件是否自动上传
        "fileType":['png','jpg','jpeg','git']//文件类型限制，默认不限制，注意写的是文件后缀
    });
    function beforeUploadFun(opt){
        opt.otherData =[{"name":"images","value":""}];
    }
    function onUploadFun(opt,data){
        alert(data);
        uploadTools.uploadError(opt);//显示上传错误
        uploadTools.uploadSuccess(opt);//显示上传成功
    }


    function testUpload(){
        var opt = uploadTools.getOpt("fileUploadContent");
        uploadEvent.uploadFileEvent(opt);
    }
   })
</script>

<script type="text/javascript">

    $(function () {
        /*ajax页面加载icheck，有该控件的页面才需要*/
        $('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({
            checkboxClass: 'icheckbox_minimal-blue',
            radioClass: 'iradio_minimal-blue'
        });

        /*ajax页面加载icheck，有该控件的页面才需要*/
        $(".select2").select2({language: "zh-CN"});

        $('.timepicker').datetimepicker({
            format: 'YYYY-MM-DD',   //YYYY-MM-DD HH:mm:ss
            locale: moment.locale('zh-cn')
        });


        {if condition = " $rest_login == 1 "}

        restlogin('{$rest_login_info}');   //登录超时
        {/if}


    })
</script>
<script>
    $(function(){

        $("#city").citySelect({
            url:"/assets/js/city.min.js",
            prov:"上海", //省份
            city:"黄浦区", //城市
            // dist:"黄浦区", //区县
            nodata:"none" //当子集无数据时，隐藏select
        });

    })
</script>
{/block}